home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 10918 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.7 KB

  1. Path: news.spb.su!demos!coin!edisoft!newsserv
  2. From: Igor Kouznetsov  <igor@bnkdp.khabarovsk.su>
  3. Newsgroups: comp.lang.c
  4. Subject: Help with writing to stdin (UNIX)
  5. Date: 21 Mar 1996 06:33:00 +1000
  6. Organization: unknown
  7. Sender: newsserv@edisoft.ru
  8. Distribution: world
  9. Message-ID: <199603210528.TAA02459@ss20.bnkdp.khabarovsk.su>
  10. Reply-To: igor@bnkdp.khabarovsk.su
  11. X-Return-Path: cent.edisoft.ru!bnkdp.khabarovsk.su!ss20.bnkdp.khabarovsk.su!bnkdp!bnkdp.khabarovsk.su!ss20.bnkdp.khabarovsk.su!igor
  12.  
  13. I create a child process (by fork()) and need to insert some input to
  14. the stdin (sure, stdin is the same for both parent and child 
  15. processes) in parent, expecting that it will appear in stdin of
  16. child. 
  17.  
  18. I tried to do that,foe example, by direct writing to buffer 
  19. pointed by according fields of stdin FILE structure, but pointer to 
  20. buffer associated with stdin turns to be NULL, I can't comprehand
  21. why :-(
  22.  
  23. I also made some attempts using other methods but they also failed
  24. for different reasons, so there's no sense to describe that struggle.
  25.  
  26. A small illustration of the task:
  27.           ----------       ---------
  28.          |  Parent  |     | Child   |
  29.          |  process |     | process |
  30. -------->|----------|---->|         |
  31.  stdin   |    ^     |     |         |
  32.          |    |     |     |         |
  33.          |   some   |     |         |
  34.          |   input  |     |         |
  35.           ---------        ---------
  36. Does anybody have any idea how to realize it?
  37. Note: I need NOT a pipe between processes but a way to insert
  38. something namely to stdin of child process.
  39.  
  40. Thanx in advance.
  41. ====================================================
  42. Igor Kouznetsov, software engineer
  43. e-mail: igor@bnkdp.khabarovsk.su 
  44.  
  45.